var TakeSurvey, appRouter;

TakeSurvey = React.createClass({
  getInitialState: function() {
    return {
      survey: null
    };
  },
  componentDidMount: function() {
    return $.getJSON("/survey/" + this.props.id, function(json) {
      return this.setState({
        survey: json
      });
    });
  },
  render: function() {
    if (this.state.survey) {
      return React.createElement("div", null, this.state.survey.title);
    } else {
      return null;
    }
  }
});

appRouter = React.createElement(Routes, {
  "location": 'history'
}, React.createElement(Route, {
  "title": 'SurveyBuilder',
  "handler": App
}, React.createElement(Route, {
  "name": 'list',
  "path": '/',
  "handler": ListSurveys
}), React.createElement(Route, {
  "title": 'Add Survey to SurveyBuilder',
  "name": 'add',
  "path": '/add_survey',
  "handler": AddSurvey
}), React.createElement(Route, {
  "name": 'edit',
  "path": '/surveys/:surveyId/edit',
  "handler": EditSurvey
}), React.createElement(Route, {
  "name": 'take',
  "path": '/surveys/:surveyId',
  "handler": TakeSurveyCtrl
}), React.createElement(NotFound, {
  "title": 'Page Not Found',
  "handler": NotFoundHandler
})));

React.renderComponent(appRouter, document.querySelector('body'));
